<?

class Debug{
	static private $enabled = false;
	static public function staticConstruct(){
		if(!empty($_SESSION['debugerr'])){ 
			self::$enabled = true;
			return;
		}
		if(!empty($_GET['debugerr'])){
			self::$enabled = true;
			$_SESSION['debugerr'] = true;
		}
		
	}
	
	static public function enabled(){
		return self::$enabled;
	}
	
	static function out($d){
		if(!self::enabled()) return;
		$args = func_get_args();
		echo implode("",$args);
	}
	
	static function print_r($var, $return = false){
		if(!self::enabled()) return;
		return print_r($var, $return);
	}
}

Debug::staticConstruct();

